package capitulo2;

/********************************************************
 * Contructores e instanciaciones (Objetivos 1.6 y 5.4)
 ********************************************************/

public class Tema15_Constructor {

	String name;
	
	Tema15_Constructor(String name){
		this.name = name;
	}
	
	Tema15_Constructor() {
		this(makeRandomName());

	}

	private static String makeRandomName() {
		int x = (int)(Math.random() * 5);
		String name = new String[] {"Fluffy", "Fido", "Rover", "Spike","Gigi"}[x]; 
		return name;
	}
	
	public static void main(String[] args) {
		
		Tema15_Constructor a = new Tema15_Constructor();
		
		System.out.println(a.name);
		
		Tema15_Constructor b = new Tema15_Constructor("Zeus");
		
		System.out.println(b.name);
		
	}
	
}
